home *** CD-ROM | disk | FTP | other *** search
/ The Sunday Times: The Month 2004 August / The Sunday Times - The Month 2004-08.iso / pc / engine / modules / download_folder.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2004-06-24  |  4.9 KB  |  161 lines

  1. function init()
  2. {
  3.    _visible = true;
  4.    text_mc._visible = false;
  5.    build();
  6. }
  7. function build()
  8. {
  9.    SCROLLBOX_INIT_POS = 58;
  10.    TEXT_POS = 2;
  11.    CONTENT_POS = 0;
  12.    var _loc2_ = Tardis.ActiveSection.id;
  13.    var _loc1_ = Tardis.Colors;
  14.    strSECTION_COLOR = _loc1_.getString(_loc2_);
  15.    SECTION_COLOR = _loc1_.getHex(_loc2_);
  16.    strSECTION_COLOR50 = _loc1_.getString(_loc2_ + "50");
  17.    SECTION_COLOR50 = _loc1_.getHex(_loc2_ + "50");
  18.    DEFAULT_COLOR = _loc1_.getHex("default");
  19.    DEFAULT_COLOR50 = _loc1_.getString("default50");
  20.    if(nodeData.byName("title").getText() != null || nodeData.byName("title2").getText() != null || nodeData.byName("title3").getText() != null)
  21.    {
  22.       var _loc3_ = "<FONT COLOR=\"" + strSECTION_COLOR + "\">" + nodeData.byName("title").getText() + " </FONT>";
  23.       _loc3_ += "<FONT COLOR=\"" + strSECTION_COLOR50 + "\"> " + nodeData.byName("title2").getText() + " </FONT>";
  24.       _loc3_ += "<FONT COLOR=\"" + DEFAULT_COLOR50 + "\"> " + nodeData.byName("title3").getText() + " </FONT>";
  25.       titleFF.htmlText = _loc3_;
  26.       titleFF._y = TEXT_POS;
  27.       titleFF.resize();
  28.       TEXT_POS += Math.ceil(titleFF._height - 3);
  29.    }
  30.    this.attachMovie("scrollContentMC","sMC",Tardis.depth++);
  31.    var ndBody = nodeData.byName("body");
  32.    if(ndBody.getText() != null)
  33.    {
  34.       sMC.bodyFF.htmlText = parseBoldTags(ndBody.getText());
  35.       sMC.bodyFF.textColor = DEFAULT_COLOR;
  36.       sMC.bodyFF.autoSize = true;
  37.       sMC.bodyFF._y = CONTENT_POS;
  38.       CONTENT_POS += sMC.bodyFF._height;
  39.    }
  40.    sMC.termsTitleFF.htmlText = "Terms and conditions";
  41.    sMC.termsTitleFF.textColor = SECTION_COLOR;
  42.    sMC.termsTitleFF._x = 0;
  43.    sMC.termsTitleFF._y = CONTENT_POS;
  44.    CONTENT_POS += sMC.termsTitleFF._height;
  45.    var ndtc = nodeData.byName("tc");
  46.    if(ndtc.getText() != null)
  47.    {
  48.       sMC.tcFF.htmlText = parseBoldTags(ndtc.getText());
  49.       sMC.tcFF.textColor = DEFAULT_COLOR;
  50.       sMC.tcFF.autoSize = true;
  51.       sMC.tcFF._y = CONTENT_POS;
  52.    }
  53.    if(sMC._height > 280)
  54.    {
  55.       this.attachMovie("FScrollPaneSymbol","contentScroll",Tardis.depth++);
  56.       attachMovie("MaskerMC","MaskerMC",Tardis.depth++);
  57.       contentScroll._x = 6;
  58.       contentScroll._y = TEXT_POS;
  59.       contentScroll.setSize(358,280);
  60.       contentScroll.setHScroll(false);
  61.       contentScroll.setScrollContent(sMC);
  62.       MaskerMC._x = 6;
  63.       MaskerMC._y = TEXT_POS - MaskerMC._height + 4;
  64.       MaskerMC._width = contentScroll._width - 17;
  65.       MaskerMC._height = 5;
  66.       TEXT_POS += contentScroll._height + 5;
  67.    }
  68.    else
  69.    {
  70.       sMC._x = 8;
  71.       sMC._y = TEXT_POS;
  72.       TEXT_POS = modHeight - bodyLinkMC._height + 14;
  73.    }
  74.    play();
  75. }
  76. function downloadFolder(f, OS)
  77. {
  78.    var _loc2_ = Tardis.ASSETS_FOLDER.indexOf("html");
  79.    var _loc1_ = Tardis.ASSETS_FOLDER.substring(_loc2_,Tardis.ASSETS_FOLDER.length) + "downloads/" + f;
  80.    getURL("Lingo:Flsh_downloadFolder(\"" + _loc1_ + "\"," + OS + ",\"" + this + "\")","");
  81. }
  82. function downloadError(strMsg)
  83. {
  84.    showError(strMsg);
  85. }
  86. function showError(strError)
  87. {
  88.    with(feedback_txt)
  89.    {
  90.       multiline = true;
  91.       wordWrap = true;
  92.       autoSize = "left";
  93.       text = strError;
  94.    }
  95. }
  96. function showTerms()
  97. {
  98.    terms_mc._visible = true;
  99. }
  100. function hideTerms()
  101. {
  102.    terms_mc._visible = false;
  103. }
  104. function parseBoldTags(str)
  105. {
  106.    var _loc1_ = str;
  107.    var _loc2_ = _loc1_.indexOf("<b>");
  108.    if(_loc2_ != -1)
  109.    {
  110.       var _loc3_ = _loc1_.indexOf("</b>");
  111.       var word = _loc1_.substring(_loc2_ + 3,_loc3_);
  112.       var beginning = _loc1_.substring(0,_loc2_);
  113.       var end = _loc1_.substring(_loc3_ + 4);
  114.       return beginning + "<font face=\'TardisBold\'>" + word + "</font>" + parseBoldTags(end);
  115.    }
  116.    return _loc1_;
  117. }
  118. function termsSetup()
  119. {
  120.    myCol = new Color("terms_mc.back_btn");
  121.    myCol.setRGB(SECTION_COLOR);
  122.    terms_mc.attachMovie("text_mc","text_mc",Tardis.depth++);
  123.    terms_mc.text_mc.body_FF.htmlText = parseBoldTags(nodeData.byName("tc").getText());
  124.    terms_mc.attachMovie("FScrollPaneSymbol","contentScroll",Tardis.depth++);
  125.    terms_mc.contentScroll._x = 10;
  126.    terms_mc.contentScroll._y = 37;
  127.    terms_mc.contentScroll.setSize(345,300);
  128.    terms_mc.contentScroll.setHScroll(false);
  129.    terms_mc.contentScroll.setScrollContent(text_mc);
  130.    terms_mc.swapDepths(Tardis.depth++);
  131.    terms_mc._visible = false;
  132. }
  133. _visible = false;
  134. stop();
  135. onReady();
  136. download_btn.onRollOver = function()
  137. {
  138.    myCol = new Color(this);
  139.    myCol.setRGB(SECTION_COLOR);
  140. };
  141. download_btn.onRollOut = function()
  142. {
  143.    myCol = new Color(this);
  144.    myCol.setRGB(SECTION_COLOR50);
  145. };
  146. download_btn.onRelease = function()
  147. {
  148.    if(this._parent.termsCheckBox.termsAgreed)
  149.    {
  150.       showError("");
  151.       downloadFolder(nodeData.byName("file").getText(),1);
  152.    }
  153.    else
  154.    {
  155.       showError("You must read and agree to the terms and conditions before you download the game demo.");
  156.    }
  157. };
  158. init();
  159. onComplete();
  160. stop();
  161.